<%@ page language="java" import="java.util.*,java.sql.*,dom.util.Connections,com.mysql.jdbc.Connection" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>个人信息修改</title>
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" href="<%=path%>/source/CSS/layui.css" media="all">
</head>
<body>
     <%
     String code=request.getParameter("code");
     
     Connection conn =Connections.getConnection();
     
     String sql="select  *  from  manager where id=?";  
     PreparedStatement  pstmt= conn.prepareStatement(sql);
     pstmt.setInt(1, Integer.parseInt(code)); 
     ResultSet rs=pstmt.executeQuery();  
     rs.last(); //移至最后一条记录 
    %>
	<div style="margin-top:100px;"></div>
	<center><h1 style="margin-bottom:10px"><b>管理员个人信息维护</b></h1></center>
	<form class="layui-form" action="<%=request.getContextPath() %>/servlet/DoDao?type=Info&count=<%=code %>" method="post" onsubmit="return checkForm()">
	  <div class="layui-form-item" style="padding-left:40%;">
	    <label class="layui-form-label">账号</label>
	    <div class="layui-input-inline" align="center" style="margin-top:8px">
	      <h3 ><b><%=code %></b></h3>
	    </div>
	  </div>
	  <div class="layui-form-item" style="padding-left:40%;">
	    <label class="layui-form-label">姓名</label>
	    <div class="layui-input-inline" align="center">
	      <input id="name" type="text" name="name" required  lay-verify="required" placeholder=<%=rs.getString("name") %> autocomplete="off" class="layui-input">、
	    </div>
	  </div>
	  <div class="layui-form-item" style="padding-left:40%;">
	    <div class="layui-input-block">
	      <button class="layui-btn" lay-submit lay-filter="formDemo" type="submit">修改</button>
	      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
	    </div>
	  </div>
	</form>	
	
    <% Connections.closeDB(conn,pstmt,rs);%> 		
	
	
	
	<script src="<%=path%>/source/JS/layui.js"></script>
	<script>
		//Demo
		layui.use('form', function(){
		  var form = layui.form;
		  
		  //监听提交
		  form.on('submit(formDemo)', function(data){
		    layer.msg(JSON.stringify(data.field));
		    return false;
		  });
		});
		
		layui.use('element', function(){
  		var element = layui.element;
  		//一些事件监听
  		element.on('tab(demo)', function(data){
    		console.log(data);
  			});
		});
			
	function checkForm(){
    		var name = document.getElementById("name").value;

    		if(name==null || name==""){
    			document.getElementById("numerror").innerHTML="姓名不能为空";
    			return false;
    		}else{
    			return true;
    		}	
    	}
	</script>
</body>
</html>
